package cn.seaboot.admin.api.service;

import cn.seaboot.admin.api.bean.ApiModelField;
import cn.seaboot.admin.api.dao.ApiModelFieldDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Service
 * 对象模型字段 [t_api_model_field]
 *
 * @author Mr.css on 2018-6-20
 */
@Service
public class ApiModelFieldService {

    @Resource
    private ApiModelFieldDao apiModelFieldDao;

    /**
     * 增
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int insert(ApiModelField pojo) {
        return apiModelFieldDao.insert(pojo);
    }

    /**
     * 删
     *
     * @param projectId 工程ID
     * @param className 对象名
     * @param fieldName 对象名
     * @return affected rows
     */
    public int deleteById(String projectId, String className, String fieldName) {
        return apiModelFieldDao.deleteById(projectId, className, fieldName);
    }

    /**
     * 删
     *
     * @param projectId 工程ID
     * @return affected rows
     */
    public int deleteByProjectId(String projectId) {
        return apiModelFieldDao.deleteByProjectId(projectId);
    }

    /**
     * 改
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int updateById(ApiModelField pojo) {
        return apiModelFieldDao.updateSampleById(pojo);
    }

    /**
     * 查
     *
     * @param projectId 工程ID
     * @param className 对象名
     * @param fieldName 对象名
     * @return pojo
     */
    public ApiModelField queryById(String projectId, String className, String fieldName) {
        return apiModelFieldDao.selectById(projectId, className, fieldName);
    }

    /**
     * 查列表
     *
     * @param projectId 工程ID
     * @param className 对象名
     * @return list
     */
    public List<ApiModelField> queryList(String projectId, String className) {
        return apiModelFieldDao.selectList(projectId, className);
    }
}
